<!DOCTYPE html>
<html>
<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>
<body class="bgf6">

	<div th:replace="common/head :: jsfHeader"></div>
	
	<div class="main-body pb100">
		<div class="container pt10">
			<div class="dflx sbt">
				<div th:replace="common/left :: jsfLeft"></div>
				
				<div class="body-right" >
					<div class="bread-nav bgff">
						<ul class="dflx">
							<li><a href="###">首页</a></li>
							<li><a href="###">统筹规划</a></li>
							<li><a href="/view/developPlan">全市发展规划</a></li>
							<li><a href="###">新增</a></li>
						</ul>
					</div>
					
					<div class="bgff mt10 pb20 edit-mode">
						<div class="wrap">
							
                            <div class="box">
                            	<div class="box-title"><span>编制规划基本信息</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title"><i class="cred">*</i> 规划名称</span>
	                					<div class="content">
	                						<input type="text" id="planName" class="form-control" value="" placeholder="请输入规划名称"/>
                							<ul style="display: none" class="parsley-errors-list filled" id="parsley-id-4"><li class="parsley-required">*请输入汉字字母</li></ul>
	                					</div>
	                        			<span class="title">规划编号</span>
	                					<div class="content">
	                						<input type="text" id="planNo" class="form-control" value="" placeholder="请输入规划编号"/>
                						</div>
                            		</div>
                            		<div class="two">
                            			<span class="title">开始年份</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" id="planBeginTime" class="form-control" placeholder="请选择年份" value="">
											</div>
	                					</div>
	                					<span class="title">截止年份</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" id="planEndTime" class="form-control" placeholder="请选择年份" value="">
											</div>
	                					</div>
                            		</div>
                					<div class="two">
                						<span class="title">编制单位</span>
	                					<div class="content">
	                						<input type="text" id="compileUnit" class="form-control" placeholder="请输入编制单位" value="" />
	                					</div>
	                					<span class="title">编制人</span>
	                    				<div class="content"><input type="text" id="compilePerson" class="form-control" placeholder="请输入编制人" value="" /></div>
                					</div>
                					
                					
                					<div class="two">
                            			<span class="title">编制时间</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" class="form-control" placeholder="请选择编制时间" id="compileTime" value="">
											</div>
	                					</div>
                            		</div>

									<div class="one">
										<span class="title fj">上传附件</span>
										<div class="content">
											<input type="file" class="filestyle" data-input="false" id="filestyle-1"
												   tabindex="-1"
												   style="position: absolute; clip: rect(0px, 0px, 0px, 0px);">
											<div class="bootstrap-filestyle input-group upload">
                        						<span class="group-span-filestyle" tabindex="0">
                                                    <i class="fa fa-plus" aria-hidden="true"></i>
                        							<p class="buttonText">上传附件</p>
                        						</span>
											</div>
											<p class="f12 c999 mt3 uploadText">只能上传jpg/png/word/pdf/zip/excle/ppt格式文件，文件不能超过50MB</p>
										</div>
									</div>
                					
                					<div class="one">
                						<span class="title">备注</span>
                        				<div class="content">
                        					<textarea name="" id="remark" class="form-control" placeholder="请输入内容" rows="" cols=""></textarea>
                        				</div>
                					</div>
                            	</div>
                            </div>
                            
                            <div class="box mt30">
                            	<div class="box-title"><span>编制规划审定</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title">审定人</span>
	                					<div class="content">
	                						<input type="text" id="auditPerson" class="form-control" value="" placeholder="请输入审定人"/>
	                					</div>
	                        			<span class="title">审定时间</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" class="form-control" placeholder="请选择审定时间" id="auditTime" value="">
											</div>
	                					</div>
                					</div>
	                					
                            		<div class="two">
                            			<span class="title">审定结果</span>
	                					<div class="content">
	                						<select class="form-control c999" id="auditResult">
												<option value='' disabled selected class='none'>请选择审定结果</option>  
		                                        <option value="1">通过</option>
		                                        <option value="2">不通过</option>
		                                    </select>
	                					</div>
                            		</div>
                            		
                            		<div class="one">
                						<span class="title">上传附件</span>
                        				<div class="content">
                        					<input type="file" class="filestyle" data-input="false" id="filestyle-2" tabindex="-1" style="position: absolute; clip: rect(0px, 0px, 0px, 0px);">
                        					<div class="bootstrap-filestyle input-group">
                        						<span class="group-span-filestyle" tabindex="0">
                        							<label for="filestyle-1" class="btn btn-white ">
                        							<span class="icon-cloud-upload"></span> 
                        							<span class="buttonText">选择上传文件</span></label>
                        						</span>
                        					</div>
                        					<p class="f12 c999 mt3">只能上传jpg/png/word/pdf/zip/excle/ppt格式文件，文件不能超过50MB</p>
                        				</div>
                					</div>
                					
                					<div class="one">
                						<span class="title">审定意见</span>
                        				<div class="content">
                        					<textarea name="" id="auditOpinion" class="form-control" placeholder="请输入审定意见（0/200）" rows="" cols=""></textarea>
                        				</div>
                					</div>
                            	</div>
                            </div>
                            
                            <div class="box mt30">
                            	<div class="box-title"><span>编制规划批准</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title">批准人</span>
	                					<div class="content">
	                						<input type="text" id="approvalPerson" class="form-control" value="" placeholder="批准人"/>
	                					</div>
	                        			<span class="title">批准时间</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" class="form-control" placeholder="请选择批准时间" id="approvalTime" value="">
											</div>
	                					</div>
                					</div>
	                					
                            		<div class="two">
                            			<span class="title">批准结果</span>
	                					<div class="content">
	                						<select class="form-control c999" id="isApproval">
												<option value='' disabled selected class='none'>请选择批准结果</option>  
		                                        <option value="1">通过</option>
		                                        <option value="2">不通过</option>
		                                    </select>
	                					</div>
                            		</div>
                            		
                					<div class="one">
                						<span class="title">批准意见</span>
                        				<div class="content">
                        					<textarea name="" id="approvalOpinion" class="form-control" placeholder="请输入批准意见（0/200）" rows="" cols=""></textarea>
                        				</div>
                					</div>
                            	</div>
                            </div>
                            
                            <div class="tc mt40">
                            	<button type="button" class="btn btn-white f12"> 取消 </button>
                            	<button type="button" class="btn btn-primary f12" onclick="submitPlan()"> 提交 </button>
								<button type="button" class="btn btn-white f12" onclick="savePlan()"> 保存 </button>
                            </div>
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	

<script type="text/javascript">
	$('#planBeginTime').fdatepicker({format: 'yyyy-mm-dd'});
	$('#planEndTime').fdatepicker({format: 'yyyy-mm-dd'});
	$('#compileTime').fdatepicker({format: 'yyyy-mm-dd'});
	$('#auditTime').fdatepicker({format: 'yyyy-mm-dd'});
	$('#approvalTime').fdatepicker({format: 'yyyy-mm-dd'});

	var statusCaoGao = 1;//草稿
	var statusTiJiao = 2;//已提交

    var appPage = new Vue({
        el : '#app',
        data : {
            plan : {}
        },
        created : function() {
        },
        methods : {

        }
    })

    function submitPlan() {
        processSavePlan(2);
    }

    function savePlan() {
        processSavePlan(1);
    }



	function processSavePlan(currentState) {
	    var params = {
	        // 'status' : statusCaoGao,
	        'planName' : $('#planName').val(),
	        'planNo' : $('#planNo').val(),
	        'planBeginTime' : $('#planBeginTime').val() + " 00:00:00",
	        'planEndTime' : $('#planEndTime').val() + " 00:00:00",
	        'compileUnit' : $('#compileUnit').val(),
	        'compilePerson' : $('#compilePerson').val(),
	        'compileTime' : $('#compileTime').val() + " 00:00:00",
	        'remark' : $('#remark').val(),
	        'auditPerson' : $('#auditPerson').val(),
	        'auditTime' : $('#auditTime').val() + " 00:00:00",
	        'auditResult' : $('#auditResult').val(),
	        'auditOpinion' : $('#auditOpinion').val(),
	        'approvalPerson' : $('#approvalPerson').val(),
	        'approvalTime' : $('#approvalTime').val() + " 00:00:00",
	        'isApproval' : $('#isApproval').val(),
	        'approvalOpinion' : $('#approvalOpinion').val(),
			'planType' : 1,
			'planLocation' : "",  //专项有的字段
			'planLocationCode' : '',
			'compileUnitId' : 0,
			'isDelete': 1,
			'currentState' : currentState
		}

		if ($('#planName').val() == '') {
			alert('请输入规划名称');
			return;
		}
        if ($('#planNo').val() == '') {
            alert('请输入规划编号');
            return;
        }
        if ($('#planBeginTime').val() == '') {
            alert('请输入开始年份');
            return;
        }
        if ($('#planEndTime').val() == '') {
            alert('请输入截止年份');
            return;
        }
        if ($('#compileTime').val() == '') {
            alert('请输入编制时间');
            return;
        }

        if ($('#auditResult').val() == '' || $('#auditResult').val() == null) {
            alert('请选择审定结果');
            return;
		}
        if ($('#isApproval').val() == '' || $('#isApproval').val() == null) {
            alert('请选择批准结果');
            return;
        }
        if ($('#auditTime').val() == '') {
            alert('请选择审定时间');
            return;
        }
        if ($('#approvalTime').val() == '') {
            alert('请选择批准时间');
            return;
        }

        $.ajax({
            'url' : contentPath + '/cityPlan/insert',
            'dataType' : 'json',
            'type' : 'post',
            'contentType':'application/json',
            'data' : JSON.stringify(params),
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.msg);
                    if (result.code == 5555) {
                        window.location.href = '/';
                    }
                    return;
                }

                appPage.$message({
                    type: 'info',
                    message: currentState == 1 ? '保存成功' : '提交成功'
                });

                window.location.href = contentPath + '/view/developPlan';
            },
            'error' : function (result) {
            }
        });

		
    }

</script>
</body>
</html>
